//
//  WebViewCellOfGood.m
//  Beauty
//
//  Created by Snow on 16/9/19.
//  Copyright © 2016年 Snow. All rights reserved.
//

#import "WebViewCellOfGood.h"
#import "GXMacro.h"
@interface WebViewCellOfGood () <UIWebViewDelegate>
@property (nonatomic, strong) UIWebView *web;
@end

@implementation WebViewCellOfGood

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createWebView];
    }
    return self;
}

- (void)createWebView {
    _web = [[UIWebView alloc] init];
    [self.contentView addSubview:_web];
    [_web mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
    _web.delegate = self;
    _web.scrollView.scrollEnabled = NO;
    
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {

    if (_webBlock) {
        
        _webBlock(_web);
    }
}

- (void)setWebString:(NSString *)webString
{
    _webString = [webString copy];
    
    [_web loadHTMLString:_webString baseURL:nil];
}
@end
